UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2I0WSrWEnOMkVB6qBgcjEKt7d5S5Q+EKDdxryqzIVqk=' 
WHERE 
  key_id = '832247c52744854df43445bf224e34b7c9685792aecac5f6cdcb8e8ba6fd6236' 
  AND (
    token = '2I0WSrWEnOMkVB6qBgcjEKt7d5S5Q+EKDdxryqzIVqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046