UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5cEaFLjuDRDzxF+fVzTPjfjQSdfQbOy+me3OUwPlv4g='
WHERE
key_id = 'b1bb61506b078713c3337732bd9d44975f565e6088939123a210a7fc7668686c'
AND (
token = '5cEaFLjuDRDzxF+fVzTPjfjQSdfQbOy+me3OUwPlv4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)