UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vJ2tMh1Fwth0uI30mstnsFlrrXrKGramzN9dAmawnZw='
WHERE
key_id = '0174d0146918f6d344d6ced34e8e5a6f91b1222a53da6c20c5b422a62ac64956'
AND (
token = 'vJ2tMh1Fwth0uI30mstnsFlrrXrKGramzN9dAmawnZw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)