UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h0xpURqaOAALV+HaDQEDHmxiHt2yhlkJLulLPhYD+58=' 
WHERE 
  key_id = 'e5f5f0ed50b821fef1e347927297a9bbb70035a10b7eab1bfa121e68c6fe1e00' 
  AND (
    token = 'h0xpURqaOAALV+HaDQEDHmxiHt2yhlkJLulLPhYD+58=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046