UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oDQkhZOytkMAduunEulka+O2aljprHMBUk0IDphWRKU='
WHERE
key_id = 'a967e7d90fc114cad0581000067786d634036c252cb18c7a3e607129c2f736b4'
AND (
token = 'oDQkhZOytkMAduunEulka+O2aljprHMBUk0IDphWRKU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)