UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L5M6mvBIgCgNW9x66Eg4SRxhgLShax0p4bSKt3hFook=' 
WHERE 
  key_id = '8b2657348d9ea28e08d4b5470a1d665fd6a9bf3e0dc117468301ee3bff2a2bbd' 
  AND (
    token = 'L5M6mvBIgCgNW9x66Eg4SRxhgLShax0p4bSKt3hFook=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029