UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qBHVsUlbfp1SoX145nkY8zgGtLQ9dqNBEyiGXxM03jw=' 
WHERE 
  key_id = '723242c28b5b3944f1d1630f8207e2d066a3aa9b4578c141032ad884c6ce5bfe' 
  AND (
    token = 'qBHVsUlbfp1SoX145nkY8zgGtLQ9dqNBEyiGXxM03jw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044