UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6GBWUoU9RRy9FfUCL+f5vasTxNieFRgvSsrKiTj7Eus='
WHERE
key_id = '2c15738ca749b6eaabaee649ef5683c8514b4a1547249e7a9e177b6f9e22fab1'
AND (
token = '6GBWUoU9RRy9FfUCL+f5vasTxNieFRgvSsrKiTj7Eus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)