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