UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V031CD+AFDiGIQ8kqm65CyvBFPCRr6t6dOeVQ51a5+k='
WHERE
key_id = '5993131ee69168c6eb4b316f0e1ac217ba452a78da2d97ff46ab63ecd32cf1fd'
AND (
token = 'V031CD+AFDiGIQ8kqm65CyvBFPCRr6t6dOeVQ51a5+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)