UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aucVeozXBexYuJbKUJVHkikiU1hGvjGijLf6Y3fbQfw='
WHERE
key_id = '693c4367ec493643a504814e8b7e4ea8afae5912e3d3c9eaa4040504d3ae0ace'
AND (
token = 'aucVeozXBexYuJbKUJVHkikiU1hGvjGijLf6Y3fbQfw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)