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