UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MAUCajlauwKFtVA4/ys0dLOdAg7d6KL8WSC4fKU1ad8=' 
WHERE 
  key_id = 'b9133d3030425ce4432326e595d74c62186726874d13e2e7b66950b1ff5aac77' 
  AND (
    token = 'MAUCajlauwKFtVA4/ys0dLOdAg7d6KL8WSC4fKU1ad8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00105