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