UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MywbC5Yrth06VNtT7Qh84rW7dgl+P3RHXRacK/LUtF8=' 
WHERE 
  key_id = 'e9ffa7800aea6e007a95f1739881da238a68b015cf75d1ab9b891e461c461906' 
  AND (
    token = 'MywbC5Yrth06VNtT7Qh84rW7dgl+P3RHXRacK/LUtF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028