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