UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R7BZb9FpzzXKm5VzYTv49FujVhePgx31UL7cYl06j+k='
WHERE
key_id = 'd7754192114c6657a4b186950700c8f8786cb55605cf92b4be7d57842e77fdf2'
AND (
token = 'R7BZb9FpzzXKm5VzYTv49FujVhePgx31UL7cYl06j+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)