UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gC2v9SeZzc3DTkOrBIIsZgettscpjUZzlHSzLQ+9s7Y=' 
WHERE 
  key_id = '3ed8087e546ed73b4f54f2380f9db6ca16aa129cd43f97215d1e78f9346a6e47' 
  AND (
    token = 'gC2v9SeZzc3DTkOrBIIsZgettscpjUZzlHSzLQ+9s7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057