UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QchvwuvAFcainG4BO6QbsqvjvWsByPaEkZh0OIblLCk=' 
WHERE 
  key_id = '0a0c22859c13b5189b88571348e7037bf86cd40b3537849872d9265015a657f6' 
  AND (
    token = 'QchvwuvAFcainG4BO6QbsqvjvWsByPaEkZh0OIblLCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065