UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BdNODcEH1wA7n75u8CvDZB5oYejdfJw1mlHDkYB5hHw='
WHERE
key_id = 'd47ac8d4cde6977488578284713027286cd25373702346d6ef3af19338363a9f'
AND (
token = 'BdNODcEH1wA7n75u8CvDZB5oYejdfJw1mlHDkYB5hHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)