UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7lj1gOXB5tAmeg9SioqBIX/ryfqBVPVlL7JbK1r8w2M='
WHERE
key_id = 'cafb43c04b9d1d2ee2235057ed3dd9d0c2321eab182909ffb56cef84ea88f14e'
AND (
token = '7lj1gOXB5tAmeg9SioqBIX/ryfqBVPVlL7JbK1r8w2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)