UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o0TMthUDS7kK+FML0WRAATv6BkcGSFLbXrza+AgK2CA='
WHERE
key_id = 'ed1adfa54bb343f70ea7505daeb037b98e78247b08e61d8d625365135140eea4'
AND (
token = 'o0TMthUDS7kK+FML0WRAATv6BkcGSFLbXrza+AgK2CA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)