UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e82NxVRRENqcSHPahaUX6tJQfxTLfcKTrPuUQea3CA0='
WHERE
key_id = '58b1fb9351fc448e276d0606375bd0e96a72777733369585919229672c517136'
AND (
token = 'e82NxVRRENqcSHPahaUX6tJQfxTLfcKTrPuUQea3CA0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)