UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fS22Nq7KrUWv7jfplTv4wWd3KNVEinpWVUxf9kmf6sQ='
WHERE
key_id = '51efa850467c2e9c8a4a4ff530546afceaf8097ec843bd26bd28b00b87ed4695'
AND (
token = 'fS22Nq7KrUWv7jfplTv4wWd3KNVEinpWVUxf9kmf6sQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)