UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cLuAK9BESN2jzxUV2muLafsPCc/jvmtsHaGRWtjpkU8='
WHERE
key_id = '44e254853ee4385e51b596cfc69d01945e670f2036203483a9f4d135c7f70173'
AND (
token = 'cLuAK9BESN2jzxUV2muLafsPCc/jvmtsHaGRWtjpkU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)