UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zewjb9jtBq3uRz7uGoBRf1he/IiuM0+nc204LDrr1F4=' 
WHERE 
  key_id = 'e9f77a17e666ca7e90b2972c7d1e35a7cc5de05234964818f2dfd200faf4d957' 
  AND (
    token = 'Zewjb9jtBq3uRz7uGoBRf1he/IiuM0+nc204LDrr1F4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065