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