UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hE8FlMKw6ANsUlnK0L+QoOahA5p3+s8rtLpOgUQxrPY=' 
WHERE 
  key_id = '805de1fde98f70837f524067de2ca0512fd48ac5880be805467d22275703991e' 
  AND (
    token = 'hE8FlMKw6ANsUlnK0L+QoOahA5p3+s8rtLpOgUQxrPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017