UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g1KGVhyOouInVEoeF77t+20AQr2hEE/BnaZzSUKko1k=' 
WHERE 
  key_id = '3e786d0b2f869ca7957678fb8a3e11af72fe355dc0904917351cb68b642cea10' 
  AND (
    token = 'g1KGVhyOouInVEoeF77t+20AQr2hEE/BnaZzSUKko1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064