UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CyCNpWikcYRdPfY8nSGqQSx6IOTZCrAYbZmSrLdlzf8='
WHERE
key_id = '6f91a763e4e33d19e28e99c254258855e254bcd81d9c1e0e48a7270a2650f314'
AND (
token = 'CyCNpWikcYRdPfY8nSGqQSx6IOTZCrAYbZmSrLdlzf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)